package com.tledu.production.service.crafts.impl;

import com.tledu.production.core.exception.CustomException;
import com.tledu.production.mapper.crafts.TechnologyPlanMapper;
import com.tledu.production.model.crafts.ProcessModel;
import com.tledu.production.model.crafts.TechnologyModel;
import com.tledu.production.model.crafts.TechnologyPlanModel;
import com.tledu.production.model.crafts.TechnologyRequirementModel;
import com.tledu.production.service.crafts.ITechnologyPlanService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@AllArgsConstructor
public class TechnologyPlanServiceImpl implements ITechnologyPlanService {
    private TechnologyPlanMapper technologyPlanMapper;
    @Override
    public List<TechnologyRequirementModel> list() {
        return technologyPlanMapper.list();
    }

    @Override
    public List<TechnologyRequirementModel> selectByName(String condition, String conditionName) {
        List<TechnologyRequirementModel> list = technologyPlanMapper.selectByName(condition,conditionName);
        if (list == null) {
            throw new CustomException("用户列表为空");
        }

        return list;
    }

    @Override
    public String finfEdit(String technologyRequirementId) {
        return technologyPlanMapper.findEdit(technologyRequirementId);
    }

    @Override
    public Integer save(String technologyRequirementId,String requirement) {
        return technologyPlanMapper.save(technologyRequirementId,requirement);
    }

    @Override
    public int delete1(String technologyRequirementId) {
        return technologyPlanMapper.delete1(technologyRequirementId);
    }

    @Override
    public int insert(TechnologyRequirementModel technologyRequirementModel) {
        return technologyPlanMapper.insert(technologyRequirementModel);
    }

    @Override
    public int updatereq(TechnologyRequirementModel technologyRequirementModel) {
        return technologyPlanMapper.updatereq(technologyRequirementModel);
    }

    @Override
    public TechnologyRequirementModel selectRe1Id(String techmologyRequirementId) {
        return technologyPlanMapper.selectReqId(techmologyRequirementId);
    }
}
